<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Create mean</title>
	<link rel="stylesheet" href="register.css" type="text/css" media="all"/>
</h:head>

<h:body style="background-image: url(images/templatemo_body.jpg) " >
	<p style="font-size: xx-large; font-family: Arial, Helvetica, sans-serif; color: #CC0000">CREATE MEAN OF TRANSPORTATION</p>
	<p:button outcome="manageTransportation" value="BACK" icon="ui-icon-arrowreturnthick-1-w"/>
			
	<br />
	
	
	<h:form id="form"> 
		<h:panelGrid columns="4" id="regGrid"> 
			
			 <h:outputLabel for="displayType">Transportation Type:</h:outputLabel>
			    <p:inputText id="displayType" value="#{productBean.mean.transportationType.toString()}"  style="width: 500px;" editable="false"/>  
			     

 				<p:commandButton id="TypeTables" value="Select" type="button" /> 
         
         
       
                   <p:overlayPanel id="TypesPanel" for="TypeTables" hideEffect="fade" dynamic="true"> 
 						 <h:form>
  				
   				 		<p:dataTable id="types" var="type" value="#{transportationBean.getTypeModel()}">  
  
							        <p:column headerText="Type" style="width:24%">  
							            <h:outputText value="#{type.type}" />  
							        </p:column>  
							  
							        <p:column headerText="Company" style="width:24%">  
							            <h:outputText value="#{type.company}" />  
							        </p:column>  
 
							  
							        <p:column style="width:4%">  
							                <p:commandButton id="selectButton" action="#{productBean.setMeanType(type)}"   icon="ui-icon-check" title="View" process="@this" update=":form:displayType">  
							            </p:commandButton>  
							        </p:column>
							
						</p:dataTable>
				   </h:form>
				    </p:overlayPanel>  
				  
				<h:outputText value="Trip:" />
					    <p:inputText id="displayHotel" value="#{productBean.mean.trip.toString()}"  style="width: 500px;" editable="false"/>  
					     
		
		 				<p:commandButton id="HotelsTables" value="Select" type="button" /> 
		         
		         
		       
		                   <p:overlayPanel id="Hotels" for="HotelsTables" hideEffect="fade" dynamic="true"> 
		 						 <h:form>
		  				<p:dataTable id="tripList" var="trip" value="#{transportationBean.getTripModel()}" >
		   				 
		   				 	<p:column headerText="TripID" style="width:30%">  
		            
		                    	<h:outputText value="#{trip.tripID}" />  
		               
					        </p:column>  
					  
					        <p:column headerText="Departure Place" style="width:20%">  
					             
					                    <h:outputText value="#{trip.departurePlace}" />  
					                  
					        </p:column>  
					        
					        <p:column headerText="Arrival Place" style="width:20%">  
					            
					                    <h:outputText value="#{trip.arrivalPlace}" />   
			        		</p:column>  
					  
					        <p:column style="width:4%">  
					                 <p:commandButton action="#{productBean.setMeanTrip(trip)}" icon="ui-icon-check" update=":form:displayHotel"  process="@this"  >  
								
					            </p:commandButton>  
					        </p:column>  
		
		    </p:dataTable>
		   </h:form>
		    </p:overlayPanel>    
		</h:panelGrid>
		<p:panel header="Properties Form">
							<h:panelGrid columns="3" id="propGrid">
								<h:outputLabel for="cost">Cost (€):</h:outputLabel>
								<p:inputText id="cost" value="#{productBean.mean.cost}" >
								<p:ajax event="keyup"/>
								</p:inputText>
								<p:message for="cost" />
								
								<h:outputLabel for="departureTime">Departure Time (hh:mm):</h:outputLabel>
								<p:inputText id="departureTime" value="#{productBean.mean.departureTime}" >
								<p:ajax event="keyup"/>
								</p:inputText>
								<p:message for="departureTime" />
								
								<h:outputLabel for="duration">duration (min):</h:outputLabel>
								<p:inputText id="duration" value="#{productBean.mean.duration}" >
								<p:ajax event="keyup"/>
								</p:inputText>
								<p:message for="duration" />
								
							</h:panelGrid>	
							<p:commandButton value="Save" update="propGrid"
								action="#{productBean.createMean()}" process="@this" type="submit"/>
				
					</p:panel>
	</h:form>
</h:body>
</html>